;;chapter-13

(concatenate 'list)

(concatenate 'vector)

(concatenate 'list (list 1 2 3) (list 4 5 6))

(concatenate 'vector #(1 2 3) #(4 5))

(concatenate 'list #(1 2 3) (list 4 5))

(concatenate 'vector #(1 2 3) (list 4 5))

(concatenate 'list "hello")

(concatenate 'vector "hello")


(elt '(1 2 3 4 5) 1)

(subseq '(1 2 3 4 5) 2)

(let ((l '(1 2 3 4 5)))
  (subseq l 2 (length l)))

(subseq '(1 2 3 4 5) 0 3)

(subseq #(#\a #\b #\c #\d #\e) 2 4)

(copy-seq '(a b c))


(defun collect-even-numbers (number-list)
  (let ((result ()))
    (dolist (number number-list)
      (when (evenp number)
	(push number result)))
    (nreverse result)))


(length '((1 2 3) (4 5) (6) 7 () 8 9 ))

(count 3 '(1 3 3 4 2 5 9 8 3 1 9))

(count-if #'oddp '(1 3 3 4 2 5 9 8 3 1 9))

(count-if-not #'evenp '(1 3 3 4 2 5 9 8 3 1 9))

(count 3 '((1 2 3) (2 3 1) (3 1 2) (2 1 3) (1 3 2) (3 2 1)) :key #'second)

(count-if #'(lambda (n)(< 3 n)) '(1 2 3 4 5 6 7))

(count 3 '(1 2 3 4 5 6 7) :test #'<)

(remove 7 '(1 2 3 a b c t nil 7 0 7 7))

(substitute '(Q) 7 '(1 2 3 a b c t nil 7 0 7 7))

(remove-duplicates '(1 2 3 a b c (1 2 3) f c g c h i a j b a k a ))

(fill (list 1 1 2 3 5 8) 7)

(fill (list 1 1 2 3 5 8) '(a b))

(fill (list 1 1 2 3 5 8) 7 :start 2 :end 4)

(let ((a (list 1 2 3 4 5 6 7))
      (b (list 9 8 7 6 5 4 3)))
  (replace a b))

(let ((a (list 1 2 3 4 5 6 7))
      (b (list 9 8 7 6 5 4 3)))
  (replace a b :start1 2))

(let ((a (list 1 2 3 4 5 6 7))
      (b (list 9 8 7 6 5 4 3)))
  (replace a b :start1 2 :end1 5))

(let ((a (list 1 2 3 4 5 6 7))
      (b (list 9 8 7 6 5 4 3)))
  (replace a b :start1 2 :end1 5 :start2 3))


(let ((a (list 1 2 3 4 5 6 7))
      (b (list 9 8 7 6 5 4 3)))
  (replace a b :start1 2 :end1 5 :start2 3 :end2 4))


(position #\a "This is all about you, isn't it?")

(position #\! "This is all about you, isn't it?")

(find #\a "This is all about you, isn't it?")

(find #\! "This is all about you, isn't it?")
(search "ab" "This is all about you, isn't it?")

(search "not so"  "This is all about you, isn't it?")

(mismatch "banana" "bananananono")

(mismatch "." "...hello")

(mismatch "............." "...hello")


(sort (list 9 3 5 4 8 7 1 2 0 6) #'>)

(sort (list 9 3 5 4 8 7 1 2 0 6) #'<)

(merge 'list (list 1 3 5 9 8) (vector 2 6 4 7 0) #'>)

(merge 'list (list 1 3 5 9 8) (list 2 6 4 7 0) #'>)

(merge 'list (list 4 3 5 9 8) (vector 2 6 4 7 0) #'>)

(merge 'list (list 1 3 5 9 8) (vector 2 6 4 7 0) #'<)




